<template>
	<div class="container" v-title data-title='动态列表'>
		<Header title="动态列表"></Header>
		<div class="no-result" v-if="count==0"></div>
		<ul class="properties-dynamic">
			<li v-for="(item, index) in items" v-on:click="toDetail(item.id)">
				<a href="javascript:;">
					<div class="template-list-right">
						<div class="title" style="width: 80%;">{{item.title}}</div>
						<div class="content">{{item.updateTime||item.createTime}}</div>
					</div>
				</a>
			</li>
			<mugen-scroll :handler="fetchData" :should-handle="!loading" >
			</mugen-scroll>
		</ul>
	</div>
</template>
<script>
	import MugenScroll from 'vue-mugen-scroll'
	export default {
		components: {
			MugenScroll
		},
		data() {
			return {
				items: [],
				params: {
					pageSize: 20,
					pageNo: 0
				},
				loading: false,
				count :0
			}
		},
		mounted: function() {
            $("#goble_menu_div").show();
		},
		methods: {
			fetchData() {
				var _self = this;
				_self.loading = true;
				_self.params.pageNo = _self.params.pageNo+1;
				var body = {};
				body.params = _self.params;
				var url = _self.utilHelper.apiUrl + "/api/getAgentPremisesDynamicPage";
				_self.$http.post(url,body).then((response) => {
					var result = response.body.resData.page;
					if(result.rows!=null){
						for(var i=0;i<result.rows.length;i++){
							_self.items.push(result.rows[i]);
						}
						_self.count = result.rows.length;
					}
					_self.loading = false;
				});

			},
			toDetail(id){
				this.$router.push({
					path: '/dynamicDetail/'+id
				})
			}
		}
	}
</script>